.TH "IXPTHREAD" 3 "2012 Dec" "libixp Manual"


.SH NAME

.P
IxpThread, IxpMutex, IxpRWLock, IxpRendez, ixp_thread

.SH SYNOPSIS

.nf
#include <ixp.h>

typedef struct IxpThread IxpThread;
struct IxpThread {
        /* Read/write lock */
        int     (*initrwlock)(IxpRWLock*);
        void    (*rlock)(IxpRWLock*);
        int     (*canrlock)(IxpRWLock*);
        void    (*runlock)(IxpRWLock*);
        void    (*wlock)(IxpRWLock*);
        int     (*canwlock)(IxpRWLock*);
        void    (*wunlock)(IxpRWLock*);
        void    (*rwdestroy)(IxpRWLock*);
        /* Mutex */
        int     (*initmutex)(IxpMutex*);
        void    (*lock)(IxpMutex*);
        int     (*canlock)(IxpMutex*);
        void    (*unlock)(IxpMutex*);
        void    (*mdestroy)(IxpMutex*);
        /* Rendezvous point */
        int     (*initrendez)(IxpRendez*);
        void    (*sleep)(IxpRendez*);
        int     (*wake)(IxpRendez*);
        int     (*wakeall)(IxpRendez*);
        void    (*rdestroy)(IxpRendez*);
        /* Other */
        char*   (*errbuf)(void);
        ssize_t (*read)(int, void*, size_t);
        ssize_t (*write)(int, const void*, size_t);
        int     (*select)(int, fd_set*, fd_set*, fd_set*, struct timeval*);
}

typedef struct IxpMutex IxpMutex;
struct IxpMutex {
        void*   aux;
}

typedef struct IxpRWLock IxpRWLock;
struct IxpRWLock {
        void*   aux;
}

typedef struct IxpRendez IxpRendez;
struct IxpRendez {
        IxpMutex*       mutex;
        void*   aux;
}

IxpThread*       ixp_thread;
.fi


.SH DESCRIPTION

.P
The IxpThread structure is used to adapt libixp to any of the
myriad threading systems it may be used with. Before any
other of libixp's functions is called, ixp_thread may be set
to a structure filled with implementations of various locking
primitives, along with primitive IO functions which may
perform context switches until data is available.

.P
The names of the functions should be fairly self\-explanitory.
Read/write locks should allow multiple readers and a single
writer of a shared resource, but should not allow new readers
while a writer is waitng for a lock. Mutexes should allow
only one accessor at a time. Rendezvous points are similar to
pthread condition types. \fIerrbuf\fR should return a
thread\-local buffer or the size IXP_ERRMAX.

.SH SEE ALSO

.P
ixp_pthread_init(3), ixp_taskinit(3), ixp_rubyinit(3)

.\" man code generated by txt2tags 2.6 (http://txt2tags.org)
.\" cmdline: txt2tags -o- IxpThread.man3
